//
//  LSApplyExpertCell.m
//  LookScore
//
//  Created by warrior on 2018/5/29.
//  Copyright © 2018年 ChongQingXunTiCompany. All rights reserved.
//

#import "LSApplyExpertCell.h"
#import "LSApplyExpertCollectionCell.h"



#pragma --- LSApplyExpertCell
@interface LSApplyExpertCell()

//@property(strong,nonatomic)UILabel *contentLab;

@end
@implementation LSApplyExpertCell

+(LSApplyExpertCell *)ApplyExpertCellByTableView:(UITableView *)tableView{
    LSApplyExpertCell *cell=[tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self)];
    if (!cell) {
        cell=[[LSApplyExpertCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(self)];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }
    return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addContentView];
    }
    
    return self;
}

-(void)addContentView{
    NSString *contentStr = @"认证通过后成为看比分推荐专家，即可发布赛事分析推荐，与广大球友一起聊比赛，不做“伪球迷”，网站工作人员将在48小时内完成审核。";
    
    UILabel *contentLab = [[UILabel alloc] init];
    //设置内容
    contentLab.text = contentStr;
    //设置字体颜色
    contentLab.textColor = LSSubColor5D5D5D;
    //设置字体大小
    contentLab.font = LSFontSize(15, LSScreenWidth);
    //设置文本是否多行显示
    contentLab.numberOfLines = 0;
    contentLab.lineBreakMode = NSLineBreakByWordWrapping;
    //设置frame
    [self.contentView addSubview:contentLab];
    contentLab.sd_layout
    .leftEqualToView(self.contentView).offset(LSAutoVlaue(20, LSScreenWidth))
    .topEqualToView(self.contentView).offset(LSAutoVlaue(0, LSScreenHeight))
    .rightEqualToView(self.contentView).offset(-LSAutoVlaue(20, LSScreenWidth))
    .heightIs(LSAutoVlaue(88, LSScreenHeight));
    //设置label的行间距
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:contentStr];
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle setLineSpacing:4];  
    [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [contentStr length])];
    [contentLab setAttributedText:attributedString];
    [contentLab sizeToFit];
    
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = LSSubGrayColorf7;
    [self.contentView addSubview:line];
    line.sd_layout
    .leftEqualToView(self.contentView)
    .rightEqualToView(self.contentView)
    .bottomEqualToView(self.contentView)
    .heightIs(1);
    
}
@end



#pragma --- LSApprovePrivilegeCell
@interface LSApprovePrivilegeCell()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic, strong) UICollectionView *collectionView;

@end

@implementation LSApprovePrivilegeCell

- (UICollectionView *)collectionView{
    if (!_collectionView) {
        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
        layout.minimumLineSpacing = 0;
        layout.minimumInteritemSpacing = 0;
        layout.itemSize = CGSizeMake(LSScreenWidth/3, (LSScreenWidth)/3);
        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.width, self.contentView.height) collectionViewLayout:layout];
        _collectionView.backgroundColor = [UIColor whiteColor];
        _collectionView.scrollEnabled = NO;
        _collectionView.delegate = self;
        _collectionView.dataSource = self;
        [_collectionView registerClass:[LSApplyExpertCollectionCell class] forCellWithReuseIdentifier:@"applyExpertCollectionCell"];
        
    }
    return _collectionView;
}

//- (NSArray *)dataSource{
//    if (!_dataSource) {
//        _dataSource = @[@{@"imageName":@"头像(1)",@"text":@"推介认证标识"},@{@"imageName":@"积分",@"text":@"发推介赚积分"},@{@"imageName":@"礼品兑换",@"text":@"积分赚取收益"}];
//    }
//    return _dataSource;
//}

+(LSApprovePrivilegeCell *)ApprovePrivilegeCellByTableView:(UITableView *)tableView{
    LSApprovePrivilegeCell *cell=[tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self)];
    if (!cell) {
        cell=[[LSApprovePrivilegeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(self)];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }return cell;
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addContentView];
    }
    
    return self;
}

-(void)addContentView{
    UIView *lineView = [[UIView alloc] init];
    lineView.backgroundColor = LSSubColor5cd2df;//LSSubColorFF9E44
    [self.contentView addSubview:lineView];
    lineView.sd_layout
    .leftEqualToView(self.contentView).offset(13)
    .topEqualToView(self.contentView).offset(10)
    .widthIs(2)
    .heightIs(17);
    
    UILabel *titleLable = [[UILabel alloc] init];
    titleLable.text = @"认证特权";
    titleLable.textColor = LSSubColor5cd2df;
    titleLable.font = LSFontSize(16, LSScreenWidth);
    [self.contentView addSubview:titleLable];
    titleLable.sd_layout
    .leftEqualToView(lineView).offset(7)
    .centerYEqualToView(lineView)
    .widthIs(100)
    .heightIs(20);
    
    
    [self.contentView addSubview:self.collectionView];
    self.collectionView.sd_layout
    .leftEqualToView(self.contentView)
    .topEqualToView(self.contentView).offset(30)
    .rightEqualToView(self.contentView)
    .bottomEqualToView(self.contentView);
    
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = LSSubGrayColorf7;
    [self.contentView addSubview:line];
    line.sd_layout
    .leftEqualToView(self.contentView)
    .rightEqualToView(self.contentView)
    .bottomEqualToView(self.contentView)
    .heightIs(1);
}

- (void)setDataSource:(NSArray *)dataSource{
    _dataSource = dataSource;
    [self.collectionView reloadData];
}
#pragma mark 🔥 UICollectionViewDelegate Datasource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    //    return _dataArray.count;r
    return self.dataSource.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    LSApplyExpertCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"applyExpertCollectionCell" forIndexPath:indexPath];

    [cell.expertHeadImg setImage:[UIImage imageNamed:self.dataSource[indexPath.row][@"imageName"]]];
    cell.expertNameLab.text = self.dataSource[indexPath.row][@"text"];
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    MyLog(@"indePath : %ld",(long)indexPath.row);
    
    
}

@end




#pragma --- LSApprovedExpertCell
@interface LSApprovedExpertCell()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic, strong) UICollectionView *collectionView;
@end

@implementation LSApprovedExpertCell

- (UICollectionView *)collectionView{
    if (!_collectionView) {
        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
        layout.minimumLineSpacing = 0;
        layout.minimumInteritemSpacing = 0;
        layout.itemSize = CGSizeMake(80, 80);
        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.width, self.contentView.height) collectionViewLayout:layout];
        _collectionView.backgroundColor = [UIColor whiteColor];
        _collectionView.scrollEnabled = NO;
        _collectionView.delegate = self;
        _collectionView.dataSource = self;
        [_collectionView registerClass:[LSApplyExpertCollectionCell class] forCellWithReuseIdentifier:@"applyExpertCollectionCell"];
        
    }
    return _collectionView;
}


//- (NSMutableArray *)dataSource{
//    if (!_dataSource) {
//        //        _dataSource = @[@{@"imageName":@"头像1",@"text":@"艾弗森"},@{@"imageName":@"头像2",@"text":@"乔丹"},@{@"imageName":@"头像3",@"text":@"科比"},@{@"imageName":@"头像4",@"text":@"詹姆斯"},@{@"imageName":@"头像1",@"text":@"艾弗森"},@{@"imageName":@"头像2",@"text":@"乔丹"},@{@"imageName":@"头像3",@"text":@"科比"},@{@"imageName":@"头像4",@"text":@"詹姆斯"}];
//        _dataSource = @[].mutableCopy;
//    }
//    return _dataSource;
//}




+(LSApprovedExpertCell *)ApprovedExpertCellByTableView:(UITableView *)tableView{
    LSApprovedExpertCell *cell=[tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self)];
    if (!cell) {
        cell=[[LSApprovedExpertCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(self)];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }return cell;
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addContentView];
    }
    
    return self;
}

-(void)addContentView{
    
    UIView *lineView = [[UIView alloc] init];
    lineView.backgroundColor = LSSubColorFF9E44;//LSSubColorFF9E44
    [self.contentView addSubview:lineView];
    lineView.sd_layout
    .leftEqualToView(self.contentView).offset(13)
    .topEqualToView(self.contentView).offset(10)
    .widthIs(2)
    .heightIs(17);
    
    UILabel *titleLable = [[UILabel alloc] init];
    titleLable.text = @"已认证专家";
    titleLable.textColor = LSSubColorf25e59;
    titleLable.font = LSFontSize(16, LSScreenWidth);
    [self.contentView addSubview:titleLable];
    titleLable.sd_layout
    .leftEqualToView(lineView).offset(7)
    .centerYEqualToView(lineView)
    .widthIs(100)
    .heightIs(20);
    
    [self.contentView addSubview:self.collectionView];
    self.collectionView.sd_layout
    .leftEqualToView(self.contentView)
    .topEqualToView(self.contentView).offset(30)
    .rightEqualToView(self.contentView)
    .bottomEqualToView(self.contentView);
    
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = LSSubGrayColorf7;
    [self.contentView addSubview:line];
    line.sd_layout
    .leftEqualToView(self.contentView)
    .rightEqualToView(self.contentView)
    .bottomEqualToView(self.contentView)
    .heightIs(1);
}

- (void)setDataSource:(NSArray *)dataSource{
    _dataSource = dataSource;
    [self.collectionView reloadData];
}

#pragma mark 🔥 UICollectionViewDelegate Datasource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    //    return _dataArray.count;r
    return self.dataSource.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    LSApplyExpertCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"applyExpertCollectionCell" forIndexPath:indexPath];
        cell.model = self.dataSource[indexPath.row];

    
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    MyLog(@"indePath : %ld",(long)indexPath.row);
    
    
}
@end



#pragma --- LSProcesstCell
@interface LSProcesstCell()

//@property(strong,nonatomic)UILabel *contentLab;

@end
@implementation LSProcesstCell

+(LSProcesstCell *)ProcesstCellByTableView:(UITableView *)tableView{
    LSProcesstCell *cell=[tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self)];
    if (!cell) {
        cell=[[LSProcesstCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(self)];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }
    return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addContentView];
    }
    
    return self;
}

-(void)addContentView{
    UIView *lineView = [[UIView alloc] init];
    lineView.backgroundColor = LSSubColorFF9E44;//LSSubColorFF9E44
    [self.contentView addSubview:lineView];
    lineView.sd_layout
    .leftEqualToView(self.contentView).offset(13)
    .topEqualToView(self.contentView).offset(10)
    .widthIs(2)
    .heightIs(17);
    
    UILabel *titleLable = [[UILabel alloc] init];
    titleLable.text = @"申请流程";
    titleLable.textColor = LSSubColorFF9E44;
    titleLable.font = LSFontSize(16, LSScreenWidth);
    [self.contentView addSubview:titleLable];
    titleLable.sd_layout
    .leftEqualToView(lineView).offset(7)
    .centerYEqualToView(lineView)
    .widthIs(100)
    .heightIs(20);
    
    UIImageView *backImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"申请流程"]];
    [self.contentView addSubview:backImage];
    backImage.sd_layout
    .leftEqualToView(self.contentView)
    .rightEqualToView(self.contentView)
    .topEqualToView(self.contentView).offset(30)
    .heightIs(LSAutoVlaue(130, LSScreenHeight));
    
    
}
@end

